import { Prisma } from '@prisma/client';
import { Transform } from 'class-transformer';
import { IsDefined, IsNotEmptyObject } from 'class-validator';
import { BaseDto, BaseFindDto, BaseQueryDto } from './base.dto';

export class AlbumCreateDto extends BaseDto<Prisma.AlbumCreateInput> {}

export class AlbumUpdateDto extends BaseDto<Prisma.AlbumUpdateInput> {
  @IsDefined({ message: '条件必填' })
  @IsNotEmptyObject({ nullable: false }, { message: '条件参数必填' })
  where: Prisma.AlbumWhereUniqueInput;
}

export class AlbumRemoveDto {
  @IsDefined({ message: 'ID必填' })
  @Transform(({ value }) => Number(value))
  id: number;
}

export class AlbumFindDto extends BaseFindDto<
  Prisma.AlbumWhereUniqueInput,
  Prisma.AlbumSelect
> {}

export class AlbumQueryDto extends BaseQueryDto<Prisma.AlbumWhereUniqueInput> {}

export class AlbumListDto extends BaseQueryDto<Prisma.AlbumWhereUniqueInput> {}
